package com.ojoin.trade.supplyloan_core.web.controller;

import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ojoin.trade.common.utils.CommonUtils;
import com.ojoin.trade.common.web.controller.BaseController;
import com.ojoin.trade.common.web.controller.BaseControllerImpl;
import com.ojoin.trade.common.web.domain.Result;
import com.ojoin.trade.common.web.service.BaseService;
import com.ojoin.trade.supplyloan_core.web.domain.TbSlStattaskRunlog;
import com.ojoin.trade.supplyloan_core.web.service.TbSlStattaskRunlogService;
 
@Controller
@RequestMapping("/tattaskrunlog")
public class TbSlStattaskRunlogController extends
		BaseControllerImpl<TbSlStattaskRunlog> implements
		BaseController<TbSlStattaskRunlog> {

	private org.slf4j.Logger log = LoggerFactory
			.getLogger(TbSlStattaskRunlogController.class);
 
	@Autowired
	private TbSlStattaskRunlogService service;

	@Override
	protected BaseService<TbSlStattaskRunlog> getBaseService() {

		return service;
	}
 
	@ResponseBody
	@RequestMapping(value = "/operate/queryById", method = {RequestMethod.GET,RequestMethod.POST})
	public Result queryById(String idOfPlatformUser,String time) { 
		log.info("idOfPlatformUser->"+idOfPlatformUser+"time->"+time); 
		try {
			
			TbSlStattaskRunlog tbr = new TbSlStattaskRunlog();
			if(!CommonUtils.isEmpty(idOfPlatformUser)){
				tbr.setIdOfPlatformUser(Integer.valueOf(idOfPlatformUser));
			}
		
			tbr.setCheckDate(time);
			
			TbSlStattaskRunlog tbsl = service.queryOne(tbr);
			return new Result(Result.Status.OK, tbsl);
		} catch (Exception e) {
			log.error("", e);
			return new Result(Result.Status.ERROR, "");
		}

	}
	
}
